﻿// ----------------------------------------------------------------
// Description : 实体类,该文件由MyGeneration生成
// Author      : 
// Create date : 2010/3/7
// ----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace ITOMMS.Entity
{
    /// <summary>
    ///	tbAsset Entity
    ///	tbAsset Entity资产设备表
    /// </summary>
    [Serializable]
    public class tbAssetEntity : BaseEntity<tbAssetEntity, int>
    {

        #region 私有成员

        private int _ID;
        private int? _customerID;
        private string _AssetNo;
        private int? _ClassID;
        private int? _AssetState;
        private string _AssetName;
        private string _AssetModel;
        private string _MadeName;
        private string _SalerName;
        private string _LinkMan;
        private string _InvoiceNo;
        private DateTime? _PurchaseDate;
        private decimal? _PurchaseMoney;
        private string _AssetVocation;
        private string _Serial_number;
        private string _AssetUser;
        private string _Principal;
        private string _AssetDescription;
        private DateTime? _CreateDate;
        private int? _CreateBy;
        private DateTime? _ModifyDate;
        private int? _ModifyBy;
        private string _Remarks;
        private string _Expand1;
        private string _Expand2;
        private string _Expand3;
        private string _Expand4;
        private string _Expand5;
        private string _Expand6;
        private string _Expand7;
        private string _Expand8;
        private string _Expand9;
        private string _Expand10;
        private string _Expand11;
        private string _Expand12;
        private string _Expand13;
        private string _Expand14;
        private string _Expand15;
        private string _Expand16;
        private string _Expand17;
        private string _Expand18;
        private string _Expand19;
        private string _Expand20;
        private string _Expand21;
        private string _Expand22;
        private string _Expand23;
        private string _Expand24;
        private string _Expand25;
        private string _Expand26;
        private string _Expand27;
        private string _Expand28;
        private string _Expand29;
        private string _Expand30;
        private string _Expand31;
        private string _Expand32;
        private string _Expand33;
        private string _Expand34;
        private int _SEQNO;
        #endregion



        #region 默认( 空 ) 构造函数
        /// <summary>
        /// 默认构造函数
        /// </summary>
        public tbAssetEntity()
        {
            _ID = 0;
            _customerID = null;
            _AssetNo = String.Empty;
            _ClassID = null;
            _AssetState = null;
            _AssetName = String.Empty;
            _AssetModel = String.Empty;
            _MadeName = String.Empty;
            _SalerName = String.Empty;
            _LinkMan = String.Empty;
            _InvoiceNo = String.Empty;
            _PurchaseDate = null;
            _PurchaseMoney = null;
            _AssetVocation = String.Empty;
            _Serial_number = String.Empty;
            _AssetUser = String.Empty;
            _Principal = String.Empty;
            _AssetDescription = String.Empty;
            _CreateDate = null;
            _CreateBy = null;
            _ModifyDate = null;
            _ModifyBy = null;
            _Remarks = String.Empty;
            _Expand1 = String.Empty;
            _Expand2 = String.Empty;
            _Expand3 = String.Empty;
            _Expand4 = String.Empty;
            _Expand5 = String.Empty;
            _Expand6 = String.Empty;
            _Expand7 = String.Empty;
            _Expand8 = String.Empty;
            _Expand9 = String.Empty;
            _Expand10 = String.Empty;
            _Expand11 = String.Empty;
            _Expand12 = String.Empty;
            _Expand13 = String.Empty;
            _Expand14 = String.Empty;
            _Expand15 = String.Empty;
            _Expand16 = String.Empty;
            _Expand17 = String.Empty;
            _Expand18 = String.Empty;
            _Expand19 = String.Empty;
            _Expand20 = String.Empty;
            _Expand21 = String.Empty;
            _Expand22 = String.Empty;
            _Expand23 = String.Empty;
            _Expand24 = String.Empty;
            _Expand25 = String.Empty;
            _Expand26 = String.Empty;
            _Expand27 = String.Empty;
            _Expand28 = String.Empty;
            _Expand29 = String.Empty;
            _Expand30 = String.Empty;
            _Expand31 = String.Empty;
            _Expand32 = String.Empty;
            _Expand33 = String.Empty;
            _Expand34 = String.Empty;
            _SEQNO = 0;
        }
        #endregion

        #region 属性值校验

        /// <summary>
        /// 属性值校验
        /// </summary>
        public bool CheckValues()
        {
            bool bResult = true;
            string strError = "";

            if (_ID == 0)
            {
                bResult = false;
                strError += "\r\n 非空值不能为: " + _ID;
            }

            if (!bResult)
                throw new ArgumentOutOfRangeException(strError);
            return bResult;

        }

        #endregion




        #region Required Fields Only Constructor

        /// <summary>
        /// required (not null) fields only constructor
        /// </summary>
        public tbAssetEntity(
        int para_ID)
            : this()
        {
            _ID = para_ID;
            _customerID = null;
            _AssetNo = String.Empty;
            _ClassID = null;
            _AssetState = null;
            _AssetName = String.Empty;
            _AssetModel = String.Empty;
            _MadeName = String.Empty;
            _SalerName = String.Empty;
            _LinkMan = String.Empty;
            _InvoiceNo = String.Empty;
            _PurchaseDate = null;
            _PurchaseMoney = null;
            _AssetVocation = String.Empty;
            _Serial_number = String.Empty;
            _AssetUser = String.Empty;
            _Principal = String.Empty;
            _AssetDescription = String.Empty;
            _CreateDate = null;
            _CreateBy = null;
            _ModifyDate = null;
            _ModifyBy = null;
            _Remarks = String.Empty;
            _Expand1 = String.Empty;
            _Expand2 = String.Empty;
            _Expand3 = String.Empty;
            _Expand4 = String.Empty;
            _Expand5 = String.Empty;
            _Expand6 = String.Empty;
            _Expand7 = String.Empty;
            _Expand8 = String.Empty;
            _Expand9 = String.Empty;
            _Expand10 = String.Empty;
            _Expand11 = String.Empty;
            _Expand12 = String.Empty;
            _Expand13 = String.Empty;
            _Expand14 = String.Empty;
            _Expand15 = String.Empty;
            _Expand16 = String.Empty;
            _Expand17 = String.Empty;
            _Expand18 = String.Empty;
            _Expand19 = String.Empty;
            _Expand20 = String.Empty;
            _Expand21 = String.Empty;
            _Expand22 = String.Empty;
            _Expand23 = String.Empty;
            _Expand24 = String.Empty;
            _Expand25 = String.Empty;
            _Expand26 = String.Empty;
            _Expand27 = String.Empty;
            _Expand28 = String.Empty;
            _Expand29 = String.Empty;
            _Expand30 = String.Empty;
            _Expand31 = String.Empty;
            _Expand32 = String.Empty;
            _Expand33 = String.Empty;
            _Expand34 = String.Empty;
        }
        #endregion


        #region 公有属性

        /// <summary>
        /// 行号，顺序号。系统默认的属性,对这个属性不要作操作.属性值在架构中已经处理
        /// </summary>
        public virtual int SEQNO
        {
            get { return _SEQNO; }
            set { _SEQNO = value; }
        }


        /// <summary>
        /// IDID
        /// </summary>		
        public virtual int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        /// <summary>
        /// customerID所属公司(客户)
        /// </summary>		
        public virtual int? customerID
        {
            get { return _customerID; }
            set { _customerID = value; }
        }

        /// <summary>
        /// AssetNo资产编号
        /// </summary>		
        public virtual string AssetNo
        {
            get { return _AssetNo; }
            set
            {

                if (value != null)
                    if (value.Length > 30)
                        throw new ArgumentOutOfRangeException("Invalid value for AssetNo", value, value.ToString());

                _AssetNo = value;
            }
        }

        /// <summary>
        /// ClassID资产类别ID
        /// </summary>		
        public virtual int? ClassID
        {
            get { return _ClassID; }
            set { _ClassID = value; }
        }

        /// <summary>
        /// AssetState资产状态
        /// </summary>		
        public virtual int? AssetState
        {
            get { return _AssetState; }
            set { _AssetState = value; }
        }

        /// <summary>
        /// AssetName资产名称
        /// </summary>		
        public virtual string AssetName
        {
            get { return _AssetName; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for AssetName", value, value.ToString());

                _AssetName = value;
            }
        }

        /// <summary>
        /// AssetModel资产型号
        /// </summary>		
        public virtual string AssetModel
        {
            get { return _AssetModel; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for AssetModel", value, value.ToString());

                _AssetModel = value;
            }
        }

        /// <summary>
        /// MadeName制造商
        /// </summary>		
        public virtual string MadeName
        {
            get { return _MadeName; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for MadeName", value, value.ToString());

                _MadeName = value;
            }
        }

        /// <summary>
        /// SalerName销售商
        /// </summary>		
        public virtual string SalerName
        {
            get { return _SalerName; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for SalerName", value, value.ToString());

                _SalerName = value;
            }
        }

        /// <summary>
        /// LinkMan联系人
        /// </summary>		
        public virtual string LinkMan
        {
            get { return _LinkMan; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for LinkMan", value, value.ToString());

                _LinkMan = value;
            }
        }

        /// <summary>
        /// InvoiceNo发票编号
        /// </summary>		
        public virtual string InvoiceNo
        {
            get { return _InvoiceNo; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for InvoiceNo", value, value.ToString());

                _InvoiceNo = value;
            }
        }

        /// <summary>
        /// PurchaseDate购买日期
        /// </summary>		
        public virtual DateTime? PurchaseDate
        {
            get { return _PurchaseDate; }
            set { _PurchaseDate = value; }
        }

        /// <summary>
        /// PurchaseMoney采购金额
        /// </summary>		
        public virtual decimal? PurchaseMoney
        {
            get { return _PurchaseMoney; }
            set { _PurchaseMoney = value; }
        }

        /// <summary>
        /// AssetVocation资产位置
        /// </summary>		
        public virtual string AssetVocation
        {
            get { return _AssetVocation; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for AssetVocation", value, value.ToString());

                _AssetVocation = value;
            }
        }

        /// <summary>
        /// Serial_number序列号
        /// </summary>		
        public virtual string Serial_number
        {
            get { return _Serial_number; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Serial_number", value, value.ToString());

                _Serial_number = value;
            }
        }

        /// <summary>
        /// AssetUser使用人
        /// </summary>		
        public virtual string AssetUser
        {
            get { return _AssetUser; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for AssetUser", value, value.ToString());

                _AssetUser = value;
            }
        }

        /// <summary>
        /// Principal负责人
        /// </summary>		
        public virtual string Principal
        {
            get { return _Principal; }
            set
            {

                if (value != null)
                    if (value.Length > 30)
                        throw new ArgumentOutOfRangeException("Invalid value for Principal", value, value.ToString());

                _Principal = value;
            }
        }

        /// <summary>
        /// AssetDescription资产描述
        /// </summary>		
        public virtual string AssetDescription
        {
            get { return _AssetDescription; }
            set
            {

                if (value != null)
                    if (value.Length > 1000)
                        throw new ArgumentOutOfRangeException("Invalid value for AssetDescription", value, value.ToString());

                _AssetDescription = value;
            }
        }

        /// <summary>
        /// CreateDate创建时间
        /// </summary>		
        public virtual DateTime? CreateDate
        {
            get { return _CreateDate; }
            set { _CreateDate = value; }
        }

        /// <summary>
        /// CreateBy创建人
        /// </summary>		
        public virtual int? CreateBy
        {
            get { return _CreateBy; }
            set { _CreateBy = value; }
        }

        /// <summary>
        /// ModifyDate修改时间
        /// </summary>		
        public virtual DateTime? ModifyDate
        {
            get { return _ModifyDate; }
            set { _ModifyDate = value; }
        }

        /// <summary>
        /// ModifyBy修改人
        /// </summary>		
        public virtual int? ModifyBy
        {
            get { return _ModifyBy; }
            set { _ModifyBy = value; }
        }

        /// <summary>
        /// Remarks备注
        /// </summary>		
        public virtual string Remarks
        {
            get { return _Remarks; }
            set
            {

                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Remarks", value, value.ToString());

                _Remarks = value;
            }
        }

        /// <summary>
        /// Expand1
        /// </summary>		
        public virtual string Expand1
        {
            get { return _Expand1; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand1", value, value.ToString());

                _Expand1 = value;
            }
        }

        /// <summary>
        /// Expand2
        /// </summary>		
        public virtual string Expand2
        {
            get { return _Expand2; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand2", value, value.ToString());

                _Expand2 = value;
            }
        }

        /// <summary>
        /// Expand3
        /// </summary>		
        public virtual string Expand3
        {
            get { return _Expand3; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand3", value, value.ToString());

                _Expand3 = value;
            }
        }

        /// <summary>
        /// Expand4
        /// </summary>		
        public virtual string Expand4
        {
            get { return _Expand4; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand4", value, value.ToString());

                _Expand4 = value;
            }
        }

        /// <summary>
        /// Expand5
        /// </summary>		
        public virtual string Expand5
        {
            get { return _Expand5; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand5", value, value.ToString());

                _Expand5 = value;
            }
        }

        /// <summary>
        /// Expand6
        /// </summary>		
        public virtual string Expand6
        {
            get { return _Expand6; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand6", value, value.ToString());

                _Expand6 = value;
            }
        }

        /// <summary>
        /// Expand7
        /// </summary>		
        public virtual string Expand7
        {
            get { return _Expand7; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand7", value, value.ToString());

                _Expand7 = value;
            }
        }

        /// <summary>
        /// Expand8
        /// </summary>		
        public virtual string Expand8
        {
            get { return _Expand8; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand8", value, value.ToString());

                _Expand8 = value;
            }
        }

        /// <summary>
        /// Expand9
        /// </summary>		
        public virtual string Expand9
        {
            get { return _Expand9; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand9", value, value.ToString());

                _Expand9 = value;
            }
        }

        /// <summary>
        /// Expand10
        /// </summary>		
        public virtual string Expand10
        {
            get { return _Expand10; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand10", value, value.ToString());

                _Expand10 = value;
            }
        }

        /// <summary>
        /// Expand11
        /// </summary>		
        public virtual string Expand11
        {
            get { return _Expand11; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand11", value, value.ToString());

                _Expand11 = value;
            }
        }

        /// <summary>
        /// Expand12
        /// </summary>		
        public virtual string Expand12
        {
            get { return _Expand12; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand12", value, value.ToString());

                _Expand12 = value;
            }
        }

        /// <summary>
        /// Expand13
        /// </summary>		
        public virtual string Expand13
        {
            get { return _Expand13; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand13", value, value.ToString());

                _Expand13 = value;
            }
        }

        /// <summary>
        /// Expand14
        /// </summary>		
        public virtual string Expand14
        {
            get { return _Expand14; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand14", value, value.ToString());

                _Expand14 = value;
            }
        }

        /// <summary>
        /// Expand15
        /// </summary>		
        public virtual string Expand15
        {
            get { return _Expand15; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand15", value, value.ToString());

                _Expand15 = value;
            }
        }

        /// <summary>
        /// Expand16
        /// </summary>		
        public virtual string Expand16
        {
            get { return _Expand16; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand16", value, value.ToString());

                _Expand16 = value;
            }
        }

        /// <summary>
        /// Expand17
        /// </summary>		
        public virtual string Expand17
        {
            get { return _Expand17; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand17", value, value.ToString());

                _Expand17 = value;
            }
        }

        /// <summary>
        /// Expand18
        /// </summary>		
        public virtual string Expand18
        {
            get { return _Expand18; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand18", value, value.ToString());

                _Expand18 = value;
            }
        }

        /// <summary>
        /// Expand19
        /// </summary>		
        public virtual string Expand19
        {
            get { return _Expand19; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand19", value, value.ToString());

                _Expand19 = value;
            }
        }

        /// <summary>
        /// Expand20
        /// </summary>		
        public virtual string Expand20
        {
            get { return _Expand20; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand20", value, value.ToString());

                _Expand20 = value;
            }
        }

        /// <summary>
        /// Expand21
        /// </summary>		
        public virtual string Expand21
        {
            get { return _Expand21; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand21", value, value.ToString());

                _Expand21 = value;
            }
        }

        /// <summary>
        /// Expand22
        /// </summary>		
        public virtual string Expand22
        {
            get { return _Expand22; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand22", value, value.ToString());

                _Expand22 = value;
            }
        }

        /// <summary>
        /// Expand23
        /// </summary>		
        public virtual string Expand23
        {
            get { return _Expand23; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand23", value, value.ToString());

                _Expand23 = value;
            }
        }

        /// <summary>
        /// Expand24
        /// </summary>		
        public virtual string Expand24
        {
            get { return _Expand24; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand24", value, value.ToString());

                _Expand24 = value;
            }
        }

        /// <summary>
        /// Expand25
        /// </summary>		
        public virtual string Expand25
        {
            get { return _Expand25; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand25", value, value.ToString());

                _Expand25 = value;
            }
        }

        /// <summary>
        /// Expand26
        /// </summary>		
        public virtual string Expand26
        {
            get { return _Expand26; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand26", value, value.ToString());

                _Expand26 = value;
            }
        }

        /// <summary>
        /// Expand27
        /// </summary>		
        public virtual string Expand27
        {
            get { return _Expand27; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand27", value, value.ToString());

                _Expand27 = value;
            }
        }

        /// <summary>
        /// Expand28
        /// </summary>		
        public virtual string Expand28
        {
            get { return _Expand28; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand28", value, value.ToString());

                _Expand28 = value;
            }
        }

        /// <summary>
        /// Expand29
        /// </summary>		
        public virtual string Expand29
        {
            get { return _Expand29; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand29", value, value.ToString());

                _Expand29 = value;
            }
        }

        /// <summary>
        /// Expand30
        /// </summary>		
        public virtual string Expand30
        {
            get { return _Expand30; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand30", value, value.ToString());

                _Expand30 = value;
            }
        }

        /// <summary>
        /// Expand31
        /// </summary>		
        public virtual string Expand31
        {
            get { return _Expand31; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand31", value, value.ToString());

                _Expand31 = value;
            }
        }

        /// <summary>
        /// Expand32
        /// </summary>		
        public virtual string Expand32
        {
            get { return _Expand32; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand32", value, value.ToString());

                _Expand32 = value;
            }
        }

        /// <summary>
        /// Expand33
        /// </summary>		
        public virtual string Expand33
        {
            get { return _Expand33; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand33", value, value.ToString());

                _Expand33 = value;
            }
        }

        /// <summary>
        /// Expand34
        /// </summary>		
        public virtual string Expand34
        {
            get { return _Expand34; }
            set
            {

                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Expand34", value, value.ToString());

                _Expand34 = value;
            }
        }



        #endregion


        #region DAO操作


        /// <summary>
        /// 获取所有实体的列表
        /// </summary>
        /// <returns></returns>
        public override List<tbAssetEntity> GetAll()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select [ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] from [tb_Asset] ");

            List<tbAssetEntity> list = new List<tbAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                int seq = 0;
                while (dataReader.Read())
                {
                    seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }

        /// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("  select count([ID])  from [tb_Asset] ");

            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }

        /// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords(string sqlCondition)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("  select count([ID])  from [tb_Asset]  ");

            if (sqlCondition.Trim() != "")
            {
                strSql.Append(" where " + sqlCondition);
            }
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }


        /// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <param name="PageSize">每页大小</param>
        /// <param name="CurrentPageIndex">当前页码</param>
        /// <returns></returns>
        public override List<tbAssetEntity> GetAllByQuery(string strWhere, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }

            strSql.Append("select top ").Append(PageSize).Append("  [ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] from [tb_Asset] where ");

            if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
            strSql.Append(" ID not in ( ");
            strSql.Append(" select top ").Append(PageSize * (CurrentPageIndex - 1)).Append("  [ID] from [tb_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" ) ");

            List<tbAssetEntity> list = new List<tbAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {
                    seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }


        /// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <param name="PageSize">每页大小</param>
        /// <param name="CurrentPageIndex">当前页码</param>
        /// <param name="strSort">ex:order by id desc</param>
        /// <returns></returns>
        public override List<tbAssetEntity> GetAllByQuery(string strWhere, string strSort, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }

            strSql.Append("select top ").Append(PageSize).Append("  [ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] from [tb_Asset] where ");

            if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
            strSql.Append(" ID not in ( ");
            strSql.Append(" select top ").Append(PageSize * (CurrentPageIndex - 1)).Append("  [ID] from [tb_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere + " ").Append(strSort);
            }
            strSql.Append(" ) ").Append(strSort);

            List<tbAssetEntity> list = new List<tbAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {
                    seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }


        /// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public override List<tbAssetEntity> GetAllByQuery(string strWhere)
        {
            strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select [ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] from tb_Asset ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbAssetEntity> list = new List<tbAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                int seq = 0;
                while (dataReader.Read())
                {
                    seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }



        /// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <param name="parameters">sql条件中的参数</param>
        /// <returns></returns>
        public override List<tbAssetEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select [ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] from [tb_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbAssetEntity> list = new List<tbAssetEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                int seq = 0;
                while (dataReader.Read())
                {
                    seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }






        /// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<tbAssetEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters, int rowNumber)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top ").Append(rowNumber).Append("  [ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] from [tb_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbAssetEntity> list = new List<tbAssetEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                int seq = 0;
                while (dataReader.Read())
                {
                    seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }


        /// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句: AND AA=@AA</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<tbAssetEntity> GetAllByQuery(string strWhere, int rowNumber)
        {
            strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top ").Append(rowNumber).Append("  [ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] from [tb_Asset] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where  " + strWhere);
            }
            List<tbAssetEntity> list = new List<tbAssetEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                int seq = 0;
                while (dataReader.Read())
                {
                    seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }







        /// <summary>
        /// 按主键查询对应的实体
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        public override tbAssetEntity GetById(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select [ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] from [tb_Asset]  where ID= @ID ");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, id);
            tbAssetEntity entity = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    entity = ReaderBind(dataReader);
                }
            }
            return entity;

        }


        /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save()
        {

            if (this.ID == 0)
            {
                this.ID = GetMax("tb_Asset");
            }
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into  tb_Asset (");
            strSql.Append("[ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] )");
            strSql.Append(" values (");
            strSql.Append("@ID,@customerID,@AssetNo,@ClassID,@AssetState,@AssetName,@AssetModel,@MadeName,@SalerName,@LinkMan,@InvoiceNo,@PurchaseDate,@PurchaseMoney,@AssetVocation,@Serial_number,@AssetUser,@Principal,@AssetDescription,@CreateDate,@CreateBy,@ModifyDate,@ModifyBy,@Remarks,@Expand1,@Expand2,@Expand3,@Expand4,@Expand5,@Expand6,@Expand7,@Expand8,@Expand9,@Expand10,@Expand11,@Expand12,@Expand13,@Expand14,@Expand15,@Expand16,@Expand17,@Expand18,@Expand19,@Expand20,@Expand21,@Expand22,@Expand23,@Expand24,@Expand25,@Expand26,@Expand27,@Expand28,@Expand29,@Expand30,@Expand31,@Expand32,@Expand33,@Expand34)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, this.ID);
            if (this.customerID == null)
            {
                db.AddInParameter(dbCommand, "customerID", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "customerID", DbType.Int32, this.customerID.Value);
            }
            db.AddInParameter(dbCommand, "AssetNo", DbType.String, this.AssetNo);
            if (this.ClassID == null)
            {
                db.AddInParameter(dbCommand, "ClassID", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ClassID", DbType.Int32, this.ClassID.Value);
            }
            if (this.AssetState == null)
            {
                db.AddInParameter(dbCommand, "AssetState", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "AssetState", DbType.Int32, this.AssetState.Value);
            }
            db.AddInParameter(dbCommand, "AssetName", DbType.String, this.AssetName);
            db.AddInParameter(dbCommand, "AssetModel", DbType.String, this.AssetModel);
            db.AddInParameter(dbCommand, "MadeName", DbType.String, this.MadeName);
            db.AddInParameter(dbCommand, "SalerName", DbType.String, this.SalerName);
            db.AddInParameter(dbCommand, "LinkMan", DbType.String, this.LinkMan);
            db.AddInParameter(dbCommand, "InvoiceNo", DbType.String, this.InvoiceNo);
            if (this.PurchaseDate == null)
            {
                db.AddInParameter(dbCommand, "PurchaseDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "PurchaseDate", DbType.DateTime, this.PurchaseDate.Value);
            }
            if (this.PurchaseMoney == null)
            {
                db.AddInParameter(dbCommand, "PurchaseMoney", DbType.Decimal, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "PurchaseMoney", DbType.Decimal, this.PurchaseMoney.Value);
            }
            db.AddInParameter(dbCommand, "AssetVocation", DbType.String, this.AssetVocation);
            db.AddInParameter(dbCommand, "Serial_number", DbType.String, this.Serial_number);
            db.AddInParameter(dbCommand, "AssetUser", DbType.String, this.AssetUser);
            db.AddInParameter(dbCommand, "Principal", DbType.String, this.Principal);
            db.AddInParameter(dbCommand, "AssetDescription", DbType.String, this.AssetDescription);
            if (this.CreateDate == null)
            {
                db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
            }
            if (this.CreateBy == null)
            {
                db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, this.CreateBy.Value);
            }
            if (this.ModifyDate == null)
            {
                db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, this.ModifyDate.Value);
            }
            if (this.ModifyBy == null)
            {
                db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, this.ModifyBy.Value);
            }
            db.AddInParameter(dbCommand, "Remarks", DbType.String, this.Remarks);
            db.AddInParameter(dbCommand, "Expand1", DbType.String, this.Expand1);
            db.AddInParameter(dbCommand, "Expand2", DbType.String, this.Expand2);
            db.AddInParameter(dbCommand, "Expand3", DbType.String, this.Expand3);
            db.AddInParameter(dbCommand, "Expand4", DbType.String, this.Expand4);
            db.AddInParameter(dbCommand, "Expand5", DbType.String, this.Expand5);
            db.AddInParameter(dbCommand, "Expand6", DbType.String, this.Expand6);
            db.AddInParameter(dbCommand, "Expand7", DbType.String, this.Expand7);
            db.AddInParameter(dbCommand, "Expand8", DbType.String, this.Expand8);
            db.AddInParameter(dbCommand, "Expand9", DbType.String, this.Expand9);
            db.AddInParameter(dbCommand, "Expand10", DbType.String, this.Expand10);
            db.AddInParameter(dbCommand, "Expand11", DbType.String, this.Expand11);
            db.AddInParameter(dbCommand, "Expand12", DbType.String, this.Expand12);
            db.AddInParameter(dbCommand, "Expand13", DbType.String, this.Expand13);
            db.AddInParameter(dbCommand, "Expand14", DbType.String, this.Expand14);
            db.AddInParameter(dbCommand, "Expand15", DbType.String, this.Expand15);
            db.AddInParameter(dbCommand, "Expand16", DbType.String, this.Expand16);
            db.AddInParameter(dbCommand, "Expand17", DbType.String, this.Expand17);
            db.AddInParameter(dbCommand, "Expand18", DbType.String, this.Expand18);
            db.AddInParameter(dbCommand, "Expand19", DbType.String, this.Expand19);
            db.AddInParameter(dbCommand, "Expand20", DbType.String, this.Expand20);
            db.AddInParameter(dbCommand, "Expand21", DbType.String, this.Expand21);
            db.AddInParameter(dbCommand, "Expand22", DbType.String, this.Expand22);
            db.AddInParameter(dbCommand, "Expand23", DbType.String, this.Expand23);
            db.AddInParameter(dbCommand, "Expand24", DbType.String, this.Expand24);
            db.AddInParameter(dbCommand, "Expand25", DbType.String, this.Expand25);
            db.AddInParameter(dbCommand, "Expand26", DbType.String, this.Expand26);
            db.AddInParameter(dbCommand, "Expand27", DbType.String, this.Expand27);
            db.AddInParameter(dbCommand, "Expand28", DbType.String, this.Expand28);
            db.AddInParameter(dbCommand, "Expand29", DbType.String, this.Expand29);
            db.AddInParameter(dbCommand, "Expand30", DbType.String, this.Expand30);
            db.AddInParameter(dbCommand, "Expand31", DbType.String, this.Expand31);
            db.AddInParameter(dbCommand, "Expand32", DbType.String, this.Expand32);
            db.AddInParameter(dbCommand, "Expand33", DbType.String, this.Expand33);
            db.AddInParameter(dbCommand, "Expand34", DbType.String, this.Expand34);

            return db.ExecuteNonQuery(dbCommand);


        }



        /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save(tbAssetEntity entity)
        {

            if (entity.ID == 0)
            {
                entity.ID = GetMax("tb_Asset");
            }
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into  tb_Asset (");
            strSql.Append("[ID],[customerID],[AssetNo],[ClassID],[AssetState],[AssetName],[AssetModel],[MadeName],[SalerName],[LinkMan],[InvoiceNo],[PurchaseDate],[PurchaseMoney],[AssetVocation],[Serial_number],[AssetUser],[Principal],[AssetDescription],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy],[Remarks],[Expand1],[Expand2],[Expand3],[Expand4],[Expand5],[Expand6],[Expand7],[Expand8],[Expand9],[Expand10],[Expand11],[Expand12],[Expand13],[Expand14],[Expand15],[Expand16],[Expand17],[Expand18],[Expand19],[Expand20],[Expand21],[Expand22],[Expand23],[Expand24],[Expand25],[Expand26],[Expand27],[Expand28],[Expand29],[Expand30],[Expand31],[Expand32],[Expand33],[Expand34] )");
            strSql.Append(" values (");
            strSql.Append("@ID,@customerID,@AssetNo,@ClassID,@AssetState,@AssetName,@AssetModel,@MadeName,@SalerName,@LinkMan,@InvoiceNo,@PurchaseDate,@PurchaseMoney,@AssetVocation,@Serial_number,@AssetUser,@Principal,@AssetDescription,@CreateDate,@CreateBy,@ModifyDate,@ModifyBy,@Remarks,@Expand1,@Expand2,@Expand3,@Expand4,@Expand5,@Expand6,@Expand7,@Expand8,@Expand9,@Expand10,@Expand11,@Expand12,@Expand13,@Expand14,@Expand15,@Expand16,@Expand17,@Expand18,@Expand19,@Expand20,@Expand21,@Expand22,@Expand23,@Expand24,@Expand25,@Expand26,@Expand27,@Expand28,@Expand29,@Expand30,@Expand31,@Expand32,@Expand33,@Expand34)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID);
            if (entity.customerID == null)
            {
                db.AddInParameter(dbCommand, "customerID", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "customerID", DbType.Int32, entity.customerID.Value);
            }
            db.AddInParameter(dbCommand, "AssetNo", DbType.String, entity.AssetNo);
            if (entity.ClassID == null)
            {
                db.AddInParameter(dbCommand, "ClassID", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ClassID", DbType.Int32, entity.ClassID.Value);
            }
            if (entity.AssetState == null)
            {
                db.AddInParameter(dbCommand, "AssetState", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "AssetState", DbType.Int32, entity.AssetState.Value);
            }
            db.AddInParameter(dbCommand, "AssetName", DbType.String, entity.AssetName);
            db.AddInParameter(dbCommand, "AssetModel", DbType.String, entity.AssetModel);
            db.AddInParameter(dbCommand, "MadeName", DbType.String, entity.MadeName);
            db.AddInParameter(dbCommand, "SalerName", DbType.String, entity.SalerName);
            db.AddInParameter(dbCommand, "LinkMan", DbType.String, entity.LinkMan);
            db.AddInParameter(dbCommand, "InvoiceNo", DbType.String, entity.InvoiceNo);
            if (entity.PurchaseDate == null)
            {
                db.AddInParameter(dbCommand, "PurchaseDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "PurchaseDate", DbType.DateTime, entity.PurchaseDate.Value);
            }
            if (entity.PurchaseMoney == null)
            {
                db.AddInParameter(dbCommand, "PurchaseMoney", DbType.Decimal, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "PurchaseMoney", DbType.Decimal, entity.PurchaseMoney.Value);
            }
            db.AddInParameter(dbCommand, "AssetVocation", DbType.String, entity.AssetVocation);
            db.AddInParameter(dbCommand, "Serial_number", DbType.String, entity.Serial_number);
            db.AddInParameter(dbCommand, "AssetUser", DbType.String, entity.AssetUser);
            db.AddInParameter(dbCommand, "Principal", DbType.String, entity.Principal);
            db.AddInParameter(dbCommand, "AssetDescription", DbType.String, entity.AssetDescription);
            if (entity.CreateDate == null)
            {
                db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
            }
            if (entity.CreateBy == null)
            {
                db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, entity.CreateBy.Value);
            }
            if (entity.ModifyDate == null)
            {
                db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, entity.ModifyDate.Value);
            }
            if (entity.ModifyBy == null)
            {
                db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, entity.ModifyBy.Value);
            }
            db.AddInParameter(dbCommand, "Remarks", DbType.String, entity.Remarks);
            db.AddInParameter(dbCommand, "Expand1", DbType.String, entity.Expand1);
            db.AddInParameter(dbCommand, "Expand2", DbType.String, entity.Expand2);
            db.AddInParameter(dbCommand, "Expand3", DbType.String, entity.Expand3);
            db.AddInParameter(dbCommand, "Expand4", DbType.String, entity.Expand4);
            db.AddInParameter(dbCommand, "Expand5", DbType.String, entity.Expand5);
            db.AddInParameter(dbCommand, "Expand6", DbType.String, entity.Expand6);
            db.AddInParameter(dbCommand, "Expand7", DbType.String, entity.Expand7);
            db.AddInParameter(dbCommand, "Expand8", DbType.String, entity.Expand8);
            db.AddInParameter(dbCommand, "Expand9", DbType.String, entity.Expand9);
            db.AddInParameter(dbCommand, "Expand10", DbType.String, entity.Expand10);
            db.AddInParameter(dbCommand, "Expand11", DbType.String, entity.Expand11);
            db.AddInParameter(dbCommand, "Expand12", DbType.String, entity.Expand12);
            db.AddInParameter(dbCommand, "Expand13", DbType.String, entity.Expand13);
            db.AddInParameter(dbCommand, "Expand14", DbType.String, entity.Expand14);
            db.AddInParameter(dbCommand, "Expand15", DbType.String, entity.Expand15);
            db.AddInParameter(dbCommand, "Expand16", DbType.String, entity.Expand16);
            db.AddInParameter(dbCommand, "Expand17", DbType.String, entity.Expand17);
            db.AddInParameter(dbCommand, "Expand18", DbType.String, entity.Expand18);
            db.AddInParameter(dbCommand, "Expand19", DbType.String, entity.Expand19);
            db.AddInParameter(dbCommand, "Expand20", DbType.String, entity.Expand20);
            db.AddInParameter(dbCommand, "Expand21", DbType.String, entity.Expand21);
            db.AddInParameter(dbCommand, "Expand22", DbType.String, entity.Expand22);
            db.AddInParameter(dbCommand, "Expand23", DbType.String, entity.Expand23);
            db.AddInParameter(dbCommand, "Expand24", DbType.String, entity.Expand24);
            db.AddInParameter(dbCommand, "Expand25", DbType.String, entity.Expand25);
            db.AddInParameter(dbCommand, "Expand26", DbType.String, entity.Expand26);
            db.AddInParameter(dbCommand, "Expand27", DbType.String, entity.Expand27);
            db.AddInParameter(dbCommand, "Expand28", DbType.String, entity.Expand28);
            db.AddInParameter(dbCommand, "Expand29", DbType.String, entity.Expand29);
            db.AddInParameter(dbCommand, "Expand30", DbType.String, entity.Expand30);
            db.AddInParameter(dbCommand, "Expand31", DbType.String, entity.Expand31);
            db.AddInParameter(dbCommand, "Expand32", DbType.String, entity.Expand32);
            db.AddInParameter(dbCommand, "Expand33", DbType.String, entity.Expand33);
            db.AddInParameter(dbCommand, "Expand34", DbType.String, entity.Expand34);

            return db.ExecuteNonQuery(dbCommand);


        }


        /// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate(tbAssetEntity entity)
        {

            if (entity.ID == 0)
            {
                if (Save(entity) > 0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update(entity);
            }
        }

        /// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate()
        {

            if (this.ID == 0)
            {
                if (Save() > 0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update();
            }
        }

        /// <summary>
        /// 是否存在对应主键ID的记录
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public override bool IsExist(int ID)
        {
            Database db = GetDatabase();
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from tb_Asset where ID=@ID ");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, ID);//这里为ID是因为原有代码把主键都变成了ID.
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }


        /// <summary>
        /// 删除对应的实体
        /// </summary>
        /// <param name="entity"></param>
        public override int Delete(tbAssetEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete tb_Asset ");
            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID);
            return db.ExecuteNonQuery(dbCommand);
        }

        /// <summary>
        /// 删除主键ID对应的记录
        /// </summary>
        /// <param name="id"></param>
        public override int Delete(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete tb_Asset ");
            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, id);
            return db.ExecuteNonQuery(dbCommand);
        }


        /// <summary>
        /// 更新一条数据
        /// </summary>
        public override int Update()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update tb_Asset set ");
            strSql.Append("[ID]=@ID,[customerID]=@customerID,[AssetNo]=@AssetNo,[ClassID]=@ClassID,[AssetState]=@AssetState,[AssetName]=@AssetName,[AssetModel]=@AssetModel,[MadeName]=@MadeName,[SalerName]=@SalerName,[LinkMan]=@LinkMan,[InvoiceNo]=@InvoiceNo,[PurchaseDate]=@PurchaseDate,[PurchaseMoney]=@PurchaseMoney,[AssetVocation]=@AssetVocation,[Serial_number]=@Serial_number,[AssetUser]=@AssetUser,[Principal]=@Principal,[AssetDescription]=@AssetDescription,[CreateDate]=@CreateDate,[CreateBy]=@CreateBy,[ModifyDate]=@ModifyDate,[ModifyBy]=@ModifyBy,[Remarks]=@Remarks,[Expand1]=@Expand1,[Expand2]=@Expand2,[Expand3]=@Expand3,[Expand4]=@Expand4,[Expand5]=@Expand5,[Expand6]=@Expand6,[Expand7]=@Expand7,[Expand8]=@Expand8,[Expand9]=@Expand9,[Expand10]=@Expand10,[Expand11]=@Expand11,[Expand12]=@Expand12,[Expand13]=@Expand13,[Expand14]=@Expand14,[Expand15]=@Expand15,[Expand16]=@Expand16,[Expand17]=@Expand17,[Expand18]=@Expand18,[Expand19]=@Expand19,[Expand20]=@Expand20,[Expand21]=@Expand21,[Expand22]=@Expand22,[Expand23]=@Expand23,[Expand24]=@Expand24,[Expand25]=@Expand25,[Expand26]=@Expand26,[Expand27]=@Expand27,[Expand28]=@Expand28,[Expand29]=@Expand29,[Expand30]=@Expand30,[Expand31]=@Expand31,[Expand32]=@Expand32,[Expand33]=@Expand33,[Expand34]=@Expand34 ");

            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, this.ID);
            if (this.customerID == null)
            {
                db.AddInParameter(dbCommand, "customerID", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "customerID", DbType.Int32, this.customerID.Value);
            }
            db.AddInParameter(dbCommand, "AssetNo", DbType.String, this.AssetNo);
            if (this.ClassID == null)
            {
                db.AddInParameter(dbCommand, "ClassID", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ClassID", DbType.Int32, this.ClassID.Value);
            }
            if (this.AssetState == null)
            {
                db.AddInParameter(dbCommand, "AssetState", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "AssetState", DbType.Int32, this.AssetState.Value);
            }
            db.AddInParameter(dbCommand, "AssetName", DbType.String, this.AssetName);
            db.AddInParameter(dbCommand, "AssetModel", DbType.String, this.AssetModel);
            db.AddInParameter(dbCommand, "MadeName", DbType.String, this.MadeName);
            db.AddInParameter(dbCommand, "SalerName", DbType.String, this.SalerName);
            db.AddInParameter(dbCommand, "LinkMan", DbType.String, this.LinkMan);
            db.AddInParameter(dbCommand, "InvoiceNo", DbType.String, this.InvoiceNo);
            if (this.PurchaseDate == null)
            {
                db.AddInParameter(dbCommand, "PurchaseDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "PurchaseDate", DbType.DateTime, this.PurchaseDate.Value);
            }
            if (this.PurchaseMoney == null)
            {
                db.AddInParameter(dbCommand, "PurchaseMoney", DbType.Decimal, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "PurchaseMoney", DbType.Decimal, this.PurchaseMoney.Value);
            }
            db.AddInParameter(dbCommand, "AssetVocation", DbType.String, this.AssetVocation);
            db.AddInParameter(dbCommand, "Serial_number", DbType.String, this.Serial_number);
            db.AddInParameter(dbCommand, "AssetUser", DbType.String, this.AssetUser);
            db.AddInParameter(dbCommand, "Principal", DbType.String, this.Principal);
            db.AddInParameter(dbCommand, "AssetDescription", DbType.String, this.AssetDescription);
            if (this.CreateDate == null)
            {
                db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
            }
            if (this.CreateBy == null)
            {
                db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, this.CreateBy.Value);
            }
            if (this.ModifyDate == null)
            {
                db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, this.ModifyDate.Value);
            }
            if (this.ModifyBy == null)
            {
                db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, this.ModifyBy.Value);
            }
            db.AddInParameter(dbCommand, "Remarks", DbType.String, this.Remarks);
            db.AddInParameter(dbCommand, "Expand1", DbType.String, this.Expand1);
            db.AddInParameter(dbCommand, "Expand2", DbType.String, this.Expand2);
            db.AddInParameter(dbCommand, "Expand3", DbType.String, this.Expand3);
            db.AddInParameter(dbCommand, "Expand4", DbType.String, this.Expand4);
            db.AddInParameter(dbCommand, "Expand5", DbType.String, this.Expand5);
            db.AddInParameter(dbCommand, "Expand6", DbType.String, this.Expand6);
            db.AddInParameter(dbCommand, "Expand7", DbType.String, this.Expand7);
            db.AddInParameter(dbCommand, "Expand8", DbType.String, this.Expand8);
            db.AddInParameter(dbCommand, "Expand9", DbType.String, this.Expand9);
            db.AddInParameter(dbCommand, "Expand10", DbType.String, this.Expand10);
            db.AddInParameter(dbCommand, "Expand11", DbType.String, this.Expand11);
            db.AddInParameter(dbCommand, "Expand12", DbType.String, this.Expand12);
            db.AddInParameter(dbCommand, "Expand13", DbType.String, this.Expand13);
            db.AddInParameter(dbCommand, "Expand14", DbType.String, this.Expand14);
            db.AddInParameter(dbCommand, "Expand15", DbType.String, this.Expand15);
            db.AddInParameter(dbCommand, "Expand16", DbType.String, this.Expand16);
            db.AddInParameter(dbCommand, "Expand17", DbType.String, this.Expand17);
            db.AddInParameter(dbCommand, "Expand18", DbType.String, this.Expand18);
            db.AddInParameter(dbCommand, "Expand19", DbType.String, this.Expand19);
            db.AddInParameter(dbCommand, "Expand20", DbType.String, this.Expand20);
            db.AddInParameter(dbCommand, "Expand21", DbType.String, this.Expand21);
            db.AddInParameter(dbCommand, "Expand22", DbType.String, this.Expand22);
            db.AddInParameter(dbCommand, "Expand23", DbType.String, this.Expand23);
            db.AddInParameter(dbCommand, "Expand24", DbType.String, this.Expand24);
            db.AddInParameter(dbCommand, "Expand25", DbType.String, this.Expand25);
            db.AddInParameter(dbCommand, "Expand26", DbType.String, this.Expand26);
            db.AddInParameter(dbCommand, "Expand27", DbType.String, this.Expand27);
            db.AddInParameter(dbCommand, "Expand28", DbType.String, this.Expand28);
            db.AddInParameter(dbCommand, "Expand29", DbType.String, this.Expand29);
            db.AddInParameter(dbCommand, "Expand30", DbType.String, this.Expand30);
            db.AddInParameter(dbCommand, "Expand31", DbType.String, this.Expand31);
            db.AddInParameter(dbCommand, "Expand32", DbType.String, this.Expand32);
            db.AddInParameter(dbCommand, "Expand33", DbType.String, this.Expand33);
            db.AddInParameter(dbCommand, "Expand34", DbType.String, this.Expand34);


            return db.ExecuteNonQuery(dbCommand);

        }





        /// <summary>
        /// 更新一条数据
        /// </summary>
        public override int Update(tbAssetEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update tb_Asset set ");
            strSql.Append("[ID]=@ID,[customerID]=@customerID,[AssetNo]=@AssetNo,[ClassID]=@ClassID,[AssetState]=@AssetState,[AssetName]=@AssetName,[AssetModel]=@AssetModel,[MadeName]=@MadeName,[SalerName]=@SalerName,[LinkMan]=@LinkMan,[InvoiceNo]=@InvoiceNo,[PurchaseDate]=@PurchaseDate,[PurchaseMoney]=@PurchaseMoney,[AssetVocation]=@AssetVocation,[Serial_number]=@Serial_number,[AssetUser]=@AssetUser,[Principal]=@Principal,[AssetDescription]=@AssetDescription,[CreateDate]=@CreateDate,[CreateBy]=@CreateBy,[ModifyDate]=@ModifyDate,[ModifyBy]=@ModifyBy,[Remarks]=@Remarks,[Expand1]=@Expand1,[Expand2]=@Expand2,[Expand3]=@Expand3,[Expand4]=@Expand4,[Expand5]=@Expand5,[Expand6]=@Expand6,[Expand7]=@Expand7,[Expand8]=@Expand8,[Expand9]=@Expand9,[Expand10]=@Expand10,[Expand11]=@Expand11,[Expand12]=@Expand12,[Expand13]=@Expand13,[Expand14]=@Expand14,[Expand15]=@Expand15,[Expand16]=@Expand16,[Expand17]=@Expand17,[Expand18]=@Expand18,[Expand19]=@Expand19,[Expand20]=@Expand20,[Expand21]=@Expand21,[Expand22]=@Expand22,[Expand23]=@Expand23,[Expand24]=@Expand24,[Expand25]=@Expand25,[Expand26]=@Expand26,[Expand27]=@Expand27,[Expand28]=@Expand28,[Expand29]=@Expand29,[Expand30]=@Expand30,[Expand31]=@Expand31,[Expand32]=@Expand32,[Expand33]=@Expand33,[Expand34]=@Expand34 ");

            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID);
            if (entity.customerID == null)
            {
                db.AddInParameter(dbCommand, "customerID", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "customerID", DbType.Int32, entity.customerID.Value);
            }
            db.AddInParameter(dbCommand, "AssetNo", DbType.String, entity.AssetNo);
            if (entity.ClassID == null)
            {
                db.AddInParameter(dbCommand, "ClassID", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ClassID", DbType.Int32, entity.ClassID.Value);
            }
            if (entity.AssetState == null)
            {
                db.AddInParameter(dbCommand, "AssetState", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "AssetState", DbType.Int32, entity.AssetState.Value);
            }
            db.AddInParameter(dbCommand, "AssetName", DbType.String, entity.AssetName);
            db.AddInParameter(dbCommand, "AssetModel", DbType.String, entity.AssetModel);
            db.AddInParameter(dbCommand, "MadeName", DbType.String, entity.MadeName);
            db.AddInParameter(dbCommand, "SalerName", DbType.String, entity.SalerName);
            db.AddInParameter(dbCommand, "LinkMan", DbType.String, entity.LinkMan);
            db.AddInParameter(dbCommand, "InvoiceNo", DbType.String, entity.InvoiceNo);
            if (entity.PurchaseDate == null)
            {
                db.AddInParameter(dbCommand, "PurchaseDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "PurchaseDate", DbType.DateTime, entity.PurchaseDate.Value);
            }
            if (entity.PurchaseMoney == null)
            {
                db.AddInParameter(dbCommand, "PurchaseMoney", DbType.Decimal, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "PurchaseMoney", DbType.Decimal, entity.PurchaseMoney.Value);
            }
            db.AddInParameter(dbCommand, "AssetVocation", DbType.String, entity.AssetVocation);
            db.AddInParameter(dbCommand, "Serial_number", DbType.String, entity.Serial_number);
            db.AddInParameter(dbCommand, "AssetUser", DbType.String, entity.AssetUser);
            db.AddInParameter(dbCommand, "Principal", DbType.String, entity.Principal);
            db.AddInParameter(dbCommand, "AssetDescription", DbType.String, entity.AssetDescription);
            if (entity.CreateDate == null)
            {
                db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
            }
            if (entity.CreateBy == null)
            {
                db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, entity.CreateBy.Value);
            }
            if (entity.ModifyDate == null)
            {
                db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, entity.ModifyDate.Value);
            }
            if (entity.ModifyBy == null)
            {
                db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
            }
            else
            {
                db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, entity.ModifyBy.Value);
            }
            db.AddInParameter(dbCommand, "Remarks", DbType.String, entity.Remarks);
            db.AddInParameter(dbCommand, "Expand1", DbType.String, entity.Expand1);
            db.AddInParameter(dbCommand, "Expand2", DbType.String, entity.Expand2);
            db.AddInParameter(dbCommand, "Expand3", DbType.String, entity.Expand3);
            db.AddInParameter(dbCommand, "Expand4", DbType.String, entity.Expand4);
            db.AddInParameter(dbCommand, "Expand5", DbType.String, entity.Expand5);
            db.AddInParameter(dbCommand, "Expand6", DbType.String, entity.Expand6);
            db.AddInParameter(dbCommand, "Expand7", DbType.String, entity.Expand7);
            db.AddInParameter(dbCommand, "Expand8", DbType.String, entity.Expand8);
            db.AddInParameter(dbCommand, "Expand9", DbType.String, entity.Expand9);
            db.AddInParameter(dbCommand, "Expand10", DbType.String, entity.Expand10);
            db.AddInParameter(dbCommand, "Expand11", DbType.String, entity.Expand11);
            db.AddInParameter(dbCommand, "Expand12", DbType.String, entity.Expand12);
            db.AddInParameter(dbCommand, "Expand13", DbType.String, entity.Expand13);
            db.AddInParameter(dbCommand, "Expand14", DbType.String, entity.Expand14);
            db.AddInParameter(dbCommand, "Expand15", DbType.String, entity.Expand15);
            db.AddInParameter(dbCommand, "Expand16", DbType.String, entity.Expand16);
            db.AddInParameter(dbCommand, "Expand17", DbType.String, entity.Expand17);
            db.AddInParameter(dbCommand, "Expand18", DbType.String, entity.Expand18);
            db.AddInParameter(dbCommand, "Expand19", DbType.String, entity.Expand19);
            db.AddInParameter(dbCommand, "Expand20", DbType.String, entity.Expand20);
            db.AddInParameter(dbCommand, "Expand21", DbType.String, entity.Expand21);
            db.AddInParameter(dbCommand, "Expand22", DbType.String, entity.Expand22);
            db.AddInParameter(dbCommand, "Expand23", DbType.String, entity.Expand23);
            db.AddInParameter(dbCommand, "Expand24", DbType.String, entity.Expand24);
            db.AddInParameter(dbCommand, "Expand25", DbType.String, entity.Expand25);
            db.AddInParameter(dbCommand, "Expand26", DbType.String, entity.Expand26);
            db.AddInParameter(dbCommand, "Expand27", DbType.String, entity.Expand27);
            db.AddInParameter(dbCommand, "Expand28", DbType.String, entity.Expand28);
            db.AddInParameter(dbCommand, "Expand29", DbType.String, entity.Expand29);
            db.AddInParameter(dbCommand, "Expand30", DbType.String, entity.Expand30);
            db.AddInParameter(dbCommand, "Expand31", DbType.String, entity.Expand31);
            db.AddInParameter(dbCommand, "Expand32", DbType.String, entity.Expand32);
            db.AddInParameter(dbCommand, "Expand33", DbType.String, entity.Expand33);
            db.AddInParameter(dbCommand, "Expand34", DbType.String, entity.Expand34);


            return db.ExecuteNonQuery(dbCommand);

        }







        /// <summary>
        /// 对象实体绑定数据
        ///生成构造为list的构造器
        /// </summary>
        private tbAssetEntity ReaderBind(IDataReader dataReader, int seq)
        {
            ITOMMS.Entity.tbAssetEntity entity = new ITOMMS.Entity.tbAssetEntity();
            entity.SEQNO = seq;
            object obj;
            obj = dataReader["ID"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.ID = (int)obj;
            }
            obj = dataReader["customerID"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.customerID = (int)obj;
            }
            entity.AssetNo = dataReader["AssetNo"].ToString();
            obj = dataReader["ClassID"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.ClassID = (int)obj;
            }
            obj = dataReader["AssetState"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.AssetState = (int)obj;
            }
            entity.AssetName = dataReader["AssetName"].ToString();
            entity.AssetModel = dataReader["AssetModel"].ToString();
            entity.MadeName = dataReader["MadeName"].ToString();
            entity.SalerName = dataReader["SalerName"].ToString();
            entity.LinkMan = dataReader["LinkMan"].ToString();
            entity.InvoiceNo = dataReader["InvoiceNo"].ToString();
            obj = dataReader["PurchaseDate"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.PurchaseDate = (DateTime)obj;
            }
            obj = dataReader["PurchaseMoney"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.PurchaseMoney = (decimal)obj;
            }
            entity.AssetVocation = dataReader["AssetVocation"].ToString();
            entity.Serial_number = dataReader["Serial_number"].ToString();
            entity.AssetUser = dataReader["AssetUser"].ToString();
            entity.Principal = dataReader["Principal"].ToString();
            entity.AssetDescription = dataReader["AssetDescription"].ToString();
            obj = dataReader["CreateDate"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.CreateDate = (DateTime)obj;
            }
            obj = dataReader["CreateBy"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.CreateBy = (int)obj;
            }
            obj = dataReader["ModifyDate"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.ModifyDate = (DateTime)obj;
            }
            obj = dataReader["ModifyBy"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.ModifyBy = (int)obj;
            }
            entity.Remarks = dataReader["Remarks"].ToString();
            entity.Expand1 = dataReader["Expand1"].ToString();
            entity.Expand2 = dataReader["Expand2"].ToString();
            entity.Expand3 = dataReader["Expand3"].ToString();
            entity.Expand4 = dataReader["Expand4"].ToString();
            entity.Expand5 = dataReader["Expand5"].ToString();
            entity.Expand6 = dataReader["Expand6"].ToString();
            entity.Expand7 = dataReader["Expand7"].ToString();
            entity.Expand8 = dataReader["Expand8"].ToString();
            entity.Expand9 = dataReader["Expand9"].ToString();
            entity.Expand10 = dataReader["Expand10"].ToString();
            entity.Expand11 = dataReader["Expand11"].ToString();
            entity.Expand12 = dataReader["Expand12"].ToString();
            entity.Expand13 = dataReader["Expand13"].ToString();
            entity.Expand14 = dataReader["Expand14"].ToString();
            entity.Expand15 = dataReader["Expand15"].ToString();
            entity.Expand16 = dataReader["Expand16"].ToString();
            entity.Expand17 = dataReader["Expand17"].ToString();
            entity.Expand18 = dataReader["Expand18"].ToString();
            entity.Expand19 = dataReader["Expand19"].ToString();
            entity.Expand20 = dataReader["Expand20"].ToString();
            entity.Expand21 = dataReader["Expand21"].ToString();
            entity.Expand22 = dataReader["Expand22"].ToString();
            entity.Expand23 = dataReader["Expand23"].ToString();
            entity.Expand24 = dataReader["Expand24"].ToString();
            entity.Expand25 = dataReader["Expand25"].ToString();
            entity.Expand26 = dataReader["Expand26"].ToString();
            entity.Expand27 = dataReader["Expand27"].ToString();
            entity.Expand28 = dataReader["Expand28"].ToString();
            entity.Expand29 = dataReader["Expand29"].ToString();
            entity.Expand30 = dataReader["Expand30"].ToString();
            entity.Expand31 = dataReader["Expand31"].ToString();
            entity.Expand32 = dataReader["Expand32"].ToString();
            entity.Expand33 = dataReader["Expand33"].ToString();
            entity.Expand34 = dataReader["Expand34"].ToString();

            return entity;
        }


        /// <summary>
        /// 对象实体绑定数据
        ///生成构造为list的构造器
        /// </summary>
        private tbAssetEntity ReaderBind(IDataReader dataReader)
        {
            ITOMMS.Entity.tbAssetEntity entity = new ITOMMS.Entity.tbAssetEntity();
            object obj;
            obj = dataReader["ID"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.ID = (int)obj;
            }
            obj = dataReader["customerID"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.customerID = (int)obj;
            }
            entity.AssetNo = dataReader["AssetNo"].ToString();
            obj = dataReader["ClassID"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.ClassID = (int)obj;
            }
            obj = dataReader["AssetState"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.AssetState = (int)obj;
            }
            entity.AssetName = dataReader["AssetName"].ToString();
            entity.AssetModel = dataReader["AssetModel"].ToString();
            entity.MadeName = dataReader["MadeName"].ToString();
            entity.SalerName = dataReader["SalerName"].ToString();
            entity.LinkMan = dataReader["LinkMan"].ToString();
            entity.InvoiceNo = dataReader["InvoiceNo"].ToString();
            obj = dataReader["PurchaseDate"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.PurchaseDate = (DateTime)obj;
            }
            obj = dataReader["PurchaseMoney"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.PurchaseMoney = (decimal)obj;
            }
            entity.AssetVocation = dataReader["AssetVocation"].ToString();
            entity.Serial_number = dataReader["Serial_number"].ToString();
            entity.AssetUser = dataReader["AssetUser"].ToString();
            entity.Principal = dataReader["Principal"].ToString();
            entity.AssetDescription = dataReader["AssetDescription"].ToString();
            obj = dataReader["CreateDate"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.CreateDate = (DateTime)obj;
            }
            obj = dataReader["CreateBy"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.CreateBy = (int)obj;
            }
            obj = dataReader["ModifyDate"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.ModifyDate = (DateTime)obj;
            }
            obj = dataReader["ModifyBy"];
            if (obj != null && obj != DBNull.Value)
            {
                entity.ModifyBy = (int)obj;
            }
            entity.Remarks = dataReader["Remarks"].ToString();
            entity.Expand1 = dataReader["Expand1"].ToString();
            entity.Expand2 = dataReader["Expand2"].ToString();
            entity.Expand3 = dataReader["Expand3"].ToString();
            entity.Expand4 = dataReader["Expand4"].ToString();
            entity.Expand5 = dataReader["Expand5"].ToString();
            entity.Expand6 = dataReader["Expand6"].ToString();
            entity.Expand7 = dataReader["Expand7"].ToString();
            entity.Expand8 = dataReader["Expand8"].ToString();
            entity.Expand9 = dataReader["Expand9"].ToString();
            entity.Expand10 = dataReader["Expand10"].ToString();
            entity.Expand11 = dataReader["Expand11"].ToString();
            entity.Expand12 = dataReader["Expand12"].ToString();
            entity.Expand13 = dataReader["Expand13"].ToString();
            entity.Expand14 = dataReader["Expand14"].ToString();
            entity.Expand15 = dataReader["Expand15"].ToString();
            entity.Expand16 = dataReader["Expand16"].ToString();
            entity.Expand17 = dataReader["Expand17"].ToString();
            entity.Expand18 = dataReader["Expand18"].ToString();
            entity.Expand19 = dataReader["Expand19"].ToString();
            entity.Expand20 = dataReader["Expand20"].ToString();
            entity.Expand21 = dataReader["Expand21"].ToString();
            entity.Expand22 = dataReader["Expand22"].ToString();
            entity.Expand23 = dataReader["Expand23"].ToString();
            entity.Expand24 = dataReader["Expand24"].ToString();
            entity.Expand25 = dataReader["Expand25"].ToString();
            entity.Expand26 = dataReader["Expand26"].ToString();
            entity.Expand27 = dataReader["Expand27"].ToString();
            entity.Expand28 = dataReader["Expand28"].ToString();
            entity.Expand29 = dataReader["Expand29"].ToString();
            entity.Expand30 = dataReader["Expand30"].ToString();
            entity.Expand31 = dataReader["Expand31"].ToString();
            entity.Expand32 = dataReader["Expand32"].ToString();
            entity.Expand33 = dataReader["Expand33"].ToString();
            entity.Expand34 = dataReader["Expand34"].ToString();

            return entity;
        }



        #endregion

    }
}
